package Test;

import static org.junit.Assert.*;

import org.junit.Test;

import customer.Update;

public class UpdateTest {
	@Test
	public void testCreate_update() {
		Update c= new Update();
		assertTrue(c.create_update() == 0);
	}

	@Test
	public void testConnect_db() {
		Update c = new Update();
		assertTrue(c.connect_db() == 0);
		assertFalse(c.connect_db() == 1);
	}

	@Test
	public void testPassword_check() {
		Update c = new Update();
		String password = "12345";
		assertTrue(c.password_check(password, "12345") == 1);
		assertFalse(c.password_check(password, "12") == 1);
	}

	@Test
	public void testNull_check() {
		Update c = new Update();
		String password = "1234567";
		String address = "yongin123";
		assertTrue(c.null_check(password, password, address) == 0);
		assertTrue(c.null_check("", password, address) == 1);
		assertTrue(c.null_check(password, "", address) == 2);
		assertTrue(c.null_check(password, password, "") == 3);
		assertTrue(c.null_check("", password, "") == 1);
	}

	@Test
	public void testPrint_db() {
		Update c = new Update();
		assertTrue(c.print_db() == 0);
	}

}
